var fs = require("fs");
var _ = require("lodash");

let fileNameC = "./data/character2";
let outputFileName = "./data/character2_only.json";

let mainData = JSON.parse(fs.readFileSync(`${fileNameC}.json`).toString());

_.forEach(mainData, (e) => {
    e.data = _.pick(e.data, ['chaLB', 'chaPas', 'chaSkills', 'characterAddAtk', 'characterAddHp', 'characterMinAtk', 'characterMinHp', 'gachaBounsAtk', 'gachaBounsHp', 'name', 'jpVoice'])
    e.data.chaLB = _.map(e.data.chaLB, (x) => _.pick(x, ['id', 'level', 'name', 'description', 'cd', 'selfBuff', 'foeBuff', 'ourBuff'])); 
    _.forEach(e.data.chaSkills, (b) => {
        b.chaSkill = _.map(b.chaSkill, (x) => _.pick(x, ['id', 'level', 'name', 'description', 'cd', 'selfBuff', 'foeBuff', 'ourBuff']));     
    })
});

fs.writeFileSync(outputFileName, JSON.stringify(mainData));
